﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class OrderMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.Order>
    {
        public OrderMap()
        {
            // table
            //ToTable("CMS_Orders");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.OrderNum)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.UserName)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.MoneyTotal)
                
                .HasPrecision(19, 4)
                .IsRequired();
            Property(t => t.MoneyGoods)
                
                .HasPrecision(19, 4)
                .IsRequired();
            Property(t => t.MoneyReceived)
                
                .HasPrecision(19, 4)
                .IsRequired();
            Property(t => t.NeedInvoice)
                
                .IsRequired();
            Property(t => t.Invoiced)
                
                .IsRequired();
            Property(t => t.Remark)
                
                .HasMaxLength(1000)
                .IsOptional();
            Property(t => t.ContacterName)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Address)
                
                .HasMaxLength(255)
                .IsOptional();
            Property(t => t.ZipCode)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Mobile)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Phone)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Email)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.PaymentType)
                
                .IsRequired();
            Property(t => t.DeliverType)
                
                .IsRequired();
            Property(t => t.Status)
                
                .IsRequired();
            Property(t => t.DeliverStatus)
                
                .IsRequired();
            Property(t => t.PayStatus)
                
                .IsRequired();
            Property(t => t.PresentExp)
                
                .IsRequired();
            Property(t => t.ChargeDeliver)
                
                .HasPrecision(19, 4)
                .IsRequired();
            Property(t => t.InvoiceContent)
                
                .HasMaxLength(1000)
                .IsOptional();
            Property(t => t.CheckInDate)
                
                .IsRequired();

            // Relationships

            //InitializeMapping();
        }
    }
}

